VERSION 5.00 Begin VB.Form frmDiscInfo BorderStyle = 3 'Fixed Dialog Caption = "Disc Info" ClientHeight = 3720 ClientLeft = 2760 ClientTop = 3750 ClientWidth = 4620 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3720 ScaleWidth = 4620 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner Begin VB.Frame fraInfo Height = 2010 Left = 255 TabIndex = 3 Top = 135 Width = 4170 Begin VB.Label lblValueDiscStatus Caption = "N/A" Height = 240 Left = 1980 TabIndex = 13 Top = 1290 Width = 2010 End Begin VB.Label lblDiscStatus Caption = "Disc Status:" Height = 240 Left = 330 TabIndex = 12 Top = 1290 Width = 1470 End Begin VB.Label lblValueFreeSpaceBlocks Caption = "N/A" Height = 240 Left = 1980 TabIndex = 11 Top = 1605 Width = 2010 End Begin VB.Label lblFreeSpace Caption = "Free Space Blocks:" Height = 240 Left = 330 TabIndex = 10 Top = 1605 Width = 1470 End Begin VB.Label lblValueDiscType Caption = "N/A" Height = 240 Left = 1980 TabIndex = 9 Top = 975 Width = 2010 End Begin VB.Label lblDiscType Caption = "Disc Type:" Height = 240 Left = 330 TabIndex = 8 Top = 975 Width = 1470 End Begin VB.Label lblValueLastSessionStatus Caption = "N/A" Height = 240 Left = 1980 TabIndex = 7 Top = 660 Width = 2010 End Begin VB.Label lblSessionStatus Caption = "Last Session Status:" Height = 240 Left = 330 TabIndex = 6 Top = 660 Width = 1470 End Begin VB.Label lblValueSessions Caption = "N/A" Height = 240 Left = 1980 TabIndex = 5 Top = 345 Width = 2010 End Begin VB.Label lblSessions Caption = "Number of Sessions:" Height = 240 Left = 330 TabIndex = 4 Top = 345 Width = 1470 End End Begin VB.CommandButton cmdCloseDisc Caption = "Close Disc" Height = 375 Left = 1755 TabIndex = 2 Top = 2640 Width = 1395 End Begin VB.CommandButton cmdCloseSession Caption = "Close Session" Height = 375 Left = 300 TabIndex = 1 Top = 2640 Width = 1395 End Begin VB.CommandButton cmdOK Caption = "OK" Height = 375 Left = 3660 TabIndex = 0 Top = 2640 Width = 780 End Begin VB.Label lblStatus Alignment = 2 'Center BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 225 Left = 720 TabIndex = 14 Top = 2205 Width = 3165 End Attribute VB_Name = "frmDiscInfo" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private WithEvents mobjCDR As CDWriterXP Attribute mobjCDR.VB_VarHelpID = -1 Private mblnClosing As Boolean '**************************************************************** '**************************************************************** 'COPYRIGHT 2001 NUGROOVZ 'This is a sample of how you could use the CDWriterXP control. 'There are improvements which could be made rather easily. 'Feel free to modify it as you see fit. '**************************************************************** '**************************************************************** Private Sub cmdCloseDisc_Click() mblnClosing = True cmdOK.Enabled = False cmdCloseDisc.Enabled = False cmdCloseSession.Enabled = False 'Call close last session method If mobjCDR.CloseLastSession(True) = False Then MsgBox "Error attempting to Close Disc!", vbCritical, App.Title mblnClosing = False cmdOK.Enabled = True cmdCloseDisc.Enabled = True cmdCloseSession.Enabled = True End If 'Events will tell us if it succeeded or not End Sub Private Sub cmdCloseSession_Click() mblnClosing = True cmdOK.Enabled = False cmdCloseDisc.Enabled = False cmdCloseSession.Enabled = False 'Call close last session method If mobjCDR.CloseLastSession(False) = False Then MsgBox "Error attempting to Close Session!", vbCritical, App.Title mblnClosing = False cmdOK.Enabled = True cmdCloseDisc.Enabled = True cmdCloseSession.Enabled = True End If 'Events will tell us if it succeeded or not End Sub Private Sub cmdOK_Click() Unload Me End Sub Private Sub Form_Unload(Cancel As Integer) If mblnClosing = True Then Cancel = 1 Exit Sub End If 'Set instance to nothing Set mobjCDR = Nothing End Sub Public Sub ShowDiscInfo(objCDR As CDWriterXP, frmParent As Form) 'Set local object Set mobjCDR = objCDR 'Check for media If mobjCDR.IsMediaLoaded() = False Then MsgBox "No Media Loaded...Cannot Get Disc Info!", vbOKOnly + vbInformation, App.Title Unload Me Exit Sub End If 'Show Form Me.Show , frmParent 'Get Disc Information SetStatus End Sub Private Sub SetStatus() 'Default these to not enabled cmdCloseDisc.Enabled = False cmdCloseSession.Enabled = False 'Reset this flag mblnClosing = False 'Set number of Sessions lblValueSessions.Caption = mobjCDR.GetSessionCount() 'Free Space blocks lblValueFreeSpaceBlocks.Caption = mobjCDR.GetDiscFreeSpaceBlocks(wtpData) 'Set Disc Status label Select Case mobjCDR.GetDiscStatus() Case dsComplete lblValueDiscStatus.Caption = "Disc is Closed" Case dsEmpty lblValueDiscStatus.Caption = "Empty Disc" Case dsIncomplete lblValueDiscStatus.Caption = "Disc Open" Case dsUnknown lblValueDiscStatus.Caption = "Unknown" End Select 'Set Disc Type label Select Case mobjCDR.GetDiscType() Case dtCddaCDRom 'Audio or Mode1 CDRom lblValueDiscType.Caption = "CD-DA/CD-ROM" Case dtCDI lblValueDiscType.Caption = "CDI" Case dtCDRomXA lblValueDiscType.Caption = "CD-ROM XA" Case dtUnknown lblValueDiscType.Caption = "Unknown" End Select 'Set Last Session Status Select Case mobjCDR.GetLastSessionStatus() Case ssEmpty lblValueLastSessionStatus.Caption = "Empty Session" Case ssIncomplete lblValueLastSessionStatus.Caption = "Incomplete Session" 'Let User Close disc/session cmdCloseSession.Enabled = True cmdCloseDisc.Enabled = True Case ssComplete lblValueLastSessionStatus.Caption = "Closed Session" Case ssReserved lblValueLastSessionStatus.Caption = "Unknown" End Select End Sub Private Sub mobjCDR_ClosingSession() lblStatus.Caption = "...Closing Session/Disc..." End Sub Private Sub mobjCDR_WriteError(ByVal WriteError As CDWriterXPLib.eWriteError, ByVal DeviceError As CDWriterXPLib.eCDError) 'Show msg to user MsgBox "Error closing Session/Disc #" & DeviceError, vbCritical, App.Title mblnClosing = False Unload Me End Sub Private Sub mobjCDR_WritingComplete() 'Close is complete lblStatus.Caption = "Closing Successful!!" SetStatus MsgBox "Session/Disc Closed Successful!", vbInformation + vbOKOnly, App.Title mblnClosing = False cmdOK.Enabled = True End Sub